import { LockState } from "@meta2d/core";
import { SvgIcon } from "@/components/common/SvgIcon.tsx";
/**
 * 锁定状态。
 */
export let lockedMap = {
  [LockState.None]: {
    title: "编辑",
    desc: "可编辑",
    icon: <SvgIcon icon={"#" + "l-unlock"} />,
    color: "var(--color)",
  },
  [LockState.DisableEdit]: {
    title: "预览",
    desc: "禁止编辑",
    icon: <SvgIcon icon={"#" + "l-lock"} />,
    color: "#faad14",
  },
  [LockState.DisableMove]: {
    title: "锁定",
    desc: "禁止移动",
    icon: <SvgIcon icon={"#" + "l-wufayidong"} />,
    color: "#f50000",
  },
  [LockState.Disable]: {
    title: "锁定",
    desc: "被禁用",
    icon: <SvgIcon icon={"#" + "l-jinyong"} />,
    color: "#f50000",
  },
};

/**
 * 获取下一个锁定状态
 * @param curLocked
 */
export const getNextLocked = (curLocked: LockState) => {
  if (curLocked == LockState.None) {
    return LockState.DisableEdit;
  }
  if (curLocked == LockState.DisableEdit) {
    return LockState.DisableMove;
  }
  if (curLocked == LockState.DisableMove) {
    return LockState.Disable;
  }
  if (curLocked == LockState.Disable) {
    return LockState.None;
  }
};
